package com.example.demo.service;

import com.example.demo.entity.Course;
import com.example.demo.mapper.CourseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseService {
    @Autowired
    private CourseMapper courseMapper;

    public List<Course> getAllCourses() {
        return courseMapper.getAll();
    }

    public int add(Course course) {
        return courseMapper.addCourse(course);
    }

    public int update(Course course) {
        return courseMapper.updateCourse(course);
    }

    public int deleteById(int id) {
        return courseMapper.deleteCourseById(id);
    }

    public Course getById(int id) {
        return courseMapper.getCourseById(id);
    }
}

